
from sklearn.preprocessing import MinMaxScaler
from sklearn import preprocessing
import pandas as pd
import numpy as np
import statsmodels.formula.api as smf
from statsmodels.formula.api import ols
import pdb
#from regressors import stats
from statsmodels.stats.outliers_influence import variance_inflation_factor




df = pd.read_excel('E:/data.xlsx')
df



df_new = df.dropna()
df_new



#线性回归
results1 = smf.ols('y ~  x20+ x21+ x22+ x24', data=df_new).fit()
print(results1.summary())


#预测函数
pt = results1.predict(df[['x20', 'x21', 'x22','x24']]).dropna()
#pdb.set_trace()
arr=pt.values
print(arr)
result = np.exp(pt)
print(result)





































































































































